package com.fare.taluo.core.domain;

import com.fare.taluo.core.domain.analyse.report.upload.ReportUploadInfo;
import com.fare.taluo.core.domain.crawl.TaskTemplateEntity;
import com.fare.taluo.core.domain.queue.message.QueueEmailMessageEntity;
import com.fare.taluo.util.DateUtils;
import com.fare.taluo.vo.core.ReportUploadInfoVO;
import com.fare.taluo.vo.core.TaskInfoEntityVO;

public class Convert {
	public static ReportUploadInfoVO convertReportUploadInfoVo(ReportUploadInfo entity){
		ReportUploadInfoVO vo = new ReportUploadInfoVO();
		vo.setEscribe(entity.getEscribe());
		vo.setId(entity.getId()+"");
		vo.setName(entity.getName());
		vo.setOperator(entity.getOperator());
		vo.setUploadDate(DateUtils.formatDay(entity.getUploadDate()));
		vo.setYear(entity.getReport_year());
		vo.setMonth(entity.getReport_month());
		vo.setPath(entity.getPath());
		return vo;
	}
	
	public static QueueEmailMessageEntity convertQueueEmailMessageEntityList(QueueEmailMessageEntity entity){
		QueueEmailMessageEntity entity_vo = new QueueEmailMessageEntity();
		entity_vo.setId(entity.getId());
		entity_vo.setToAddress(entity.getToAddress());
		entity_vo.setCreateTime(entity.getCreateTime());
		entity_vo.setAttachPath(entity.getAttachPath());
		entity_vo.setBody(entity.getBody());
		entity_vo.setCopyToAddress(entity.getCopyToAddress());
		entity_vo.setFromAddress(entity.getFromAddress());
		entity_vo.setStatus(entity.getStatus());
		entity_vo.setSubject(entity.getSubject());
		
		return entity_vo;
	}
	
	public static TaskInfoEntityVO convertTaskInfoEntityToVo(TaskTemplateEntity task){
		TaskInfoEntityVO vo = new TaskInfoEntityVO();
		vo.setId(task.getId());
		vo.setTaskName(task.getName());
		vo.setFrequency(task.getFrequency()+"");
		vo.setFromCity(task.getFromCity());
		vo.setGrabChannel(task.getGrabChannel());
		vo.setFromCityName(task.getFromCityName());
		vo.setToCityName(task.getToCityName());
		vo.setPriority(task.getPriority());
		//
		
		vo.setIsReturn(task.getIsReturn().toString());
		vo.setReturnDateScope(task.getReturnDateScope());
		vo.setGrabsopeBegin(task.getGrabScopeBegin());
		vo.setGrabsopeEnd(task.getGrabScopeEnd());
		//vo.setGrabsope(task.getGrabsope());
		vo.setRemark(task.getRemark());
		vo.setToCity(task.getToCity());
		vo.setValidityFrom(task.getValidityFrom());
		vo.setValidityTo(task.getValidityTo());
		vo.setUserCreateTime(task.getCreateTime());
		vo.setUserName(task.getUserName());
		
		return vo;
		
		
	}
	
}
